package wsi.gui.predpath;

import java.awt.Dimension;
import java.awt.event.KeyEvent;

import org.rygh.gui.swing.button.SButton;
import org.rygh.gui.swing.button.SCloseButton;
import org.rygh.gui.swing.presenter.SwingPresenter;
import org.rygh.gui.swing.table.STableView;
import org.rygh.gui.swing.view.one.SOneTableView;
import org.rygh.gui.swing.window.SwingWindow;

@SuppressWarnings("serial")
public class PredicatePathWindow extends SwingWindow implements
		PredicatePathPresenter.Display {

	private final SOneTableView view = new SOneTableView();
	private final SwingPresenter presenter;

	public PredicatePathWindow(SwingPresenter presenter) {
		super("Merge Functionalities of Predicate Paths");

		this.presenter = presenter;

		layoutComponents();
		center();
	}

	@Override
	public STableView getTable() {
		return view.getTable();
	}

	private void layoutComponents() {
		view.setPreferredSize(new Dimension(580, 480));
		getTable().setSortable();

		addCenterView(view);

		addButton(new SCloseButton(this));
		addButton(new SButton("Clear", KeyEvent.VK_C, presenter, "clear"));
		addButton(new SButton("Save", KeyEvent.VK_S, presenter, "save"));
		addButton(new SButton("Merge", KeyEvent.VK_M, presenter, "merge"));

		pack();

	}
}
